package dao;

import java.sql.SQLException;
import java.util.Vector;
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		CreateTables createTables = new CreateTables(); //tenta criar tabelas
		createTables.CreateTablesMethod("birddb");
		Bird bird = new Bird("blablabla", 8, 10, 15, "Um bixo qqr", "mapa1");
		
		Vector<Bird> birds = new Vector<Bird>();
		
		try{
			ConnectionManager.connect("birddb");
		}
		catch(SQLException ex){
			System.out.println("Bugou na hora de conectar");
		}
		catch(ClassNotFoundException ex){
			System.out.println("Bugou na hora de achar o driver");
		}
		
		try{
		birds = Bird.byPopularName("Nome popular qqr um");
		}
		catch(SQLException ex){
			System.out.println("bugou no byfood: " + ex);
		}
		System.out.println(birds.firstElement().getScientificName()); //mostra o nome cientifico buscando por nome popular
		
		try{
		birds = Bird.byFood("Alpiste");
		}
		catch(SQLException ex){
			System.out.println("bugou no byfood: " + ex);
		}
		System.out.println(birds.firstElement().getSize()); //mostra o tamanho do cara que come alpiste
	}

}
